<template>
    <div class="business">
         <div class="list">
              <div class="list-item">
                  <div class="charts-item">
                        <common-title>
                            项目进度占比
                        </common-title>
                        <div class="charts-box">
                            <ve-ring :data="chartData" :settings="chartSettings" :legend-visible="false" width="100%" height="228px" style="position: relative;top:14px;"></ve-ring>
                            <div class="label-list">
                                <div class="label-item" v-for="(item, i) in labelList" :key="i">
                                    <div class="top">
                                        <span class="label-icon" :class="`label-icon-${i}`"></span>{{item.label}}
                                        <span class="num">{{item.num}}个</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
              </div>
              <div class="list-item">
                  <div class="charts-item">
                        <common-title>
                            项目统计
                        </common-title>
                        <div class="project-static">
                            <div class="static-item">
                                 <div class="num active">213</div>
                                 <div class="name">在建项目数(个)</div>
                            </div>
                            <div class="static-item">
                                 <div class="num">213</div>
                                 <div class="name">在建分包数(个）</div>
                            </div>
                            <div class="static-item">
                                 <div class="num">213</div>
                                 <div class="name">在建项目工人数(人）</div>
                            </div>
                        </div>
                    </div>
              </div>
              <div class="list-item">
                  <div class="charts-item">
                        <common-title>
                            在建工种分布
                        </common-title>
                        <div class="charts-box">
                            <ve-ring :data="chartData" :settings="chartSettings" :legend-visible="false" width="100%" height="228px" style="position: relative;top:14px;"></ve-ring>
                            <div class="label-list">
                                <div class="label-item" v-for="(item, i) in labelsList" :key="i">
                                    <div class="top">
                                        <span class="label-icon" :class="`label-icon-${i}`"></span>{{item.label}}
                                        <span class="num">{{item.num}}个</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
              </div>
              <div class="list-item">
                  <div class="charts-item">
                        <common-title>
                            <div class="special-title">
                            用工量
                            <Radio-group v-model="useWorker">
                                <Radio label="一周"></Radio>
                                <Radio label="一月"></Radio>
                                <Radio label="一年"></Radio>
                            </Radio-group>
                            </div>
                        </common-title>
                        <div class="charts-box">
                            <ve-line :data="chartDatas"  :legend-visible="false" width="100%" height="228px" style="position: relative;top:14px;"></ve-line>
                        </div>
                    </div>
              </div>
               <div class="list-item">
                  <div class="charts-item">
                        <common-title>
                            <div class="special-title">
                            承接数
                            <Radio-group v-model="useWorker">
                                <Radio label="一周"></Radio>
                                <Radio label="一月"></Radio>
                                <Radio label="一年"></Radio>
                            </Radio-group>
                            </div>
                        </common-title>
                        <div class="charts-box">
                            <ve-line :data="chartDatas"  :legend-visible="false" width="100%" height="228px" style="position: relative;top:14px;"></ve-line>
                        </div>
                    </div>
              </div>
               <div class="list-item">
                  <div class="charts-item">
                        <common-title>
                            <div class="special-title">
                            发包数
                            <Radio-group v-model="useWorker">
                                <Radio label="一周"></Radio>
                                <Radio label="一月"></Radio>
                                <Radio label="一年"></Radio>
                            </Radio-group>
                            </div>
                        </common-title>
                        <div class="charts-box">
                            <ve-line :data="chartDatas"  :legend-visible="false" width="100%" height="228px" style="position: relative;top:14px;"></ve-line>
                        </div>
                    </div>
              </div>
         </div>
    </div>
</template>
<script>
import {VeRing, VeLine} from 'v-charts'
export default {
    name: 'business',
    components: {
        VeRing,
        VeLine
    },
    data () {
    this.chartSettings = {
        radius: [30, 60],
        labelLine: {
          show: false
        },
        label: {
          show: false
        },
        offsetY: 90
    }
    this.settings = {
        itemStyle: {
            color: '#3CA0FF'
        },
        label: {
            show: true,		//开启显示
            position: 'center',	//在上方显示
            textStyle: {	    //数值样式
                color: '#0467E0',
                fontSize: 12
            }
        }
        }
    this.extendss = {
        barWidth: 30,
        yAxis: {
                minInterval: 1
            }
    }
    this.optionss = {
        xAxis: {
            nameTextStyle: {
                color: '#f00',
                fontSize: '10'
            }
        }
    }
    return {
      chartData: {
        columns: ['日期', '访问用户'],
        rows: [
          { '日期': '1/1', '访问用户': 1393 },
          { '日期': '1/2', '访问用户': 3530 },
          { '日期': '1/3', '访问用户': 2923 }
        ]
      },
      chartDatas: {
            columns: ["日期", "访问用户", "下单用户", "下单率"],
            rows: [
                { 日期: "1/1", 访问用户: 1393, 下单用户: 1093, 下单率: 0.32 },
                { 日期: "1/2", 访问用户: 3530, 下单用户: 3230, 下单率: 0.26 },
                { 日期: "1/3", 访问用户: 2923, 下单用户: 2623, 下单率: 0.76 },
                { 日期: "1/4", 访问用户: 1723, 下单用户: 1423, 下单率: 0.49 },
                { 日期: "1/5", 访问用户: 3792, 下单用户: 3492, 下单率: 0.323 },
                { 日期: "1/6", 访问用户: 4593, 下单用户: 4293, 下单率: 0.78 }
            ]
      },
      labelList: [
          {
              label: '在建(个)',
              num: '5'
          },
          {
              label: '未开始(个)',
              num: '5'
          },
          {
              label: '已结束(个)',
              num: '5'
          }
      ],
      labelsList: [
          {
              label: '木工',
              num: '5'
          },
          {
              label: '水泥工',
              num: '5'
          },
          {
              label: '砌筑工',
              num: '5'
          },
          {
              label: '其他',
              num: '5'
          },
      ],
      useWorker: ''
    }
  }
}
</script>
<style lang="less" scoped>
* {
    box-sizing: border-box;
}
.business {
    >.list {
        display:flex;
        flex-wrap: wrap;
        width: 100%;
        .list-item {
            width: calc(50% - 5px);
            margin-right: 10px;
            background: #fff;
            margin-bottom: 10px;
            &:nth-child(2n + 2) {
                margin-right: 0;
            }
            .project-static {
                height: 228px;
                display:flex;
                align-items: center;
                justify-content: center;
                .static-item {
                    flex:1;
                    display:flex;
                    align-items: center;
                    flex-direction: column;
                    justify-content: center;
                    font-size: 12px;
                    color: #999;
                    .num {
                        font-size:36px;
                        color: #333;
                        margin-bottom: 16px;
                        &.active {
                            color: #F5222D;
                        }
                    }
                }
            }
        }
    }
    .charts-item {
        background: #fff;
        overflow:hidden;
        .charts-box {
            width: 100%;
            overflow:hidden;
            position: relative;
            height: 228px;
            display:flex;
            .label-list {
                width: 50%;
                display:flex;
                text-align: center;
                flex-direction: column;
                justify-content: center;
                .label-item {
                    font-size: 14px;
                    color: #666;
                    margin-bottom: 18px;
                    .label-icon {
                        display: inline-block;
                        border-radius: 50%;
                        width: 8px;
                        height: 8px;
                        vertical-align: middle;
                        margin-right: 5px;
                        &.label-icon-0 {
                            background-color: #1298FC;
                        }
                        &.label-icon-1 {
                            background-color: #FEB400;
                        }
                        &.label-icon-2 {
                            background-color: #FF528A;
                        }
                    }
                    .top {
                        font-size: 14px;
                        color: #333;
                        display:flex;
                        align-items: center;
                        justify-content: center;
                        .num {
                            margin-left: 18px;
                        }
                    }
                }
            }
        }
    }
    .special-title {
        display:flex;
        justify-content: space-between;
    }
}
</style>